#include <iostream>

using namespace std;

class Point
{
public:
    Point(){}
    Point(int x);
    ~Point();
    Point(const Point & rhs);
    Point & operator=(const Point & rhs);
    
    void print();
    int getNum()const;

private:
    int *_ix;
};


Point::Point(int x): _ix(new int){*_ix = x;}
Point::~Point()
{
    delete _ix;
    _ix = nullptr;
}
Point::Point(const Point & rhs): _ix(new int)
{
    *_ix = rhs.getNum();
}
Point & Point::operator=(const Point & rhs)
{
    if(this == &rhs)
        return *this;
    if(this->_ix)
        delete _ix;
    _ix = new int;
    *(this->_ix) = rhs.getNum();

    return *this;
}

int Point::getNum()const
{
    return *_ix;
}

void Point::print()
{
    cout << "x = " << *_ix << endl;
}

void test()
{
    Point p(10);
    Point p1(p);
    Point p2 = p1;
    Point p3 = 1;
    Point p4;
    p4 = p3;

    p1.print();
    p2.print();
    p3.print();
    p4.print();
}

int main()
{
    test();
    return 0;
}

